﻿using System;
using BattleNet.DataAccess.Parsers.Html;
using BattleNet.DataAccess.Parsers.Interface;
using BattleNet.DataAccess.SourceProviders.Interface;
using BattleNet.DataAccess.SourceProviders.Web;
using Ninject;
using Ninject.Modules;
using System.Linq;
namespace BattleNet.WorldOfWarcraft.Modules
{
    public class HtmlModule : NinjectModule
    {
        private const string realmFolder = "/en/status";

        public override void Load()
        {
            Bind<ISourceProvider<string>>().To<WebSourceProvider>().WithConstructorArgument("uri", (c, t) => ((Region)c.Parameters.First(p => p.Name == "Region").GetValue(c, t)).ToUri() + realmFolder);
            Bind<IRealmFinder>().To<HtmlRealmFinder>();
        }
    }

}
